<template>
    <div class="process-monitoring-box">
        <commpVxeTable
         :key="dataTableKey"
         :config="dataTableConfig" 
         :columns="columnsVxe" 
         :formItem="formItem"
         ref="acceptanceRegistrationRef"
         @checkboxChange="selectedRowKeysChange"
         @searchEvent="searchEvent"
         >
            <template v-slot:username_name="{row}">
                <a @click="infoEdit(row)">{{ row.username }}</a>
            </template>
            <template v-slot:fshzt_name="{row}" data-desc="自定操作栏">
                <span v-if="row.fshzt == '已审核'" style="color: #09f921;">{{ row.fshzt }}</span>
                <span v-else style="color: #f90909;">{{ row.fshzt }}</span>
            </template>
            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                <a-form layout="inline" class="search-form" >
                    <a-form-item >
                        <a-button class="blue-btn" type="primary" @click="toExamine(row)">审核</a-button>
                    </a-form-item>
                    <a-form-item >
                        <a-button class="blue-btn" type="primary" @click="viewClick(row)">查看</a-button>
                    </a-form-item>
                </a-form>
            </template>
        </commpVxeTable>
        <changeUnit ref="changeUnitRef" @refreshClick="refreshClick" />
    </div>
</template>
<script>
import assessCheckApi from './service/api'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import blobType from '@/common/blobType'
import moment from 'moment'
import compSelector from '@/components/compSelector/compSelector.vue'
import changeUnit from '../personalInfo/changeUnit.vue'
import {
    queryJobByJobIdServe,
    getSqsxBm,
    spcyJcydjbfqJcydjb,
    spcyJcydjbreplateFile,
    jcyglexportJcyLbData,
    jcyglbatchSzSsk,
    jcyglbatchSzJcyState,
    jcyglupdateUserInfo,
} from './service/index'
export default {
    components:{
        commpVxeTable,
        compSelector,
        changeUnit,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            batchData:{},
            addEditParameter:{},
            dataTableKey:null,
            formItem:[
                {
                    label: '审评类型',//(检查员登记类别)字典
                    model: 'flx',
                    type:'Radio',
                    dictionaryType:'检查员登记类别',
                    defaultValue:'药物临床',
                },{
                    label: '有效状态',
                    model: 'fstate',
                    type:'Select',
                    dictionaryType:'核查员有效状态'
                },{
                    label: '姓名',
                    model: 'realname',
                },{
                    label: '工作单位',
                    model: 'fgzdw',
                },{
                    label: '所属库',
                    model: 'fssk',
                }],//
            columnsVxe:[
            { 
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '账号', //列头显示文字
                field: 'username',
                slots: { default: 'username_name' },
                width:120,
            },{
                title: '姓名', //列头显示文字
                field: 'realname',
                width:90,
            },{
                title: '变更类型',
                field: 'fbglx',
            },{
                title: '变更前工作单位',
                field: 'fbgqxx',
            },{
                title: '变更后工作单位',
                field: 'fbghxx',
            },{
                title: '发起时间',
                field: 'ffqsj',
            },{
                title: '审核状态',
                field: 'fshzt',
                slots: {
                // 使用插槽模板渲染
                    default: 'fshzt_name',
                },
            },{
                title: '操作',
                field: 'id',
                slots: { default: 'operation_btn' },
                fixed: 'right',
                width:260,
            }],

            dataTableConfig:{
                api: assessCheckApi.list,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                paramet:{
                    flx:'药物临床'
                }
            },
            selectedRowKeysArr:[],
            searchFrom:{},
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        cjhfClick(){
            this.$route.push('/enterpriseWithdrawalApplication/index')
        },
        timeProcessing(val){
            if(val){
                val = val.slice(0,11)
            }
            return val
        },
        shareQRCodeClick(){//分享二维码
            this.$refs.QRQueryResultsRef.visibleQRQrCode = true
            this.$refs.QRQueryResultsRef.getData()
        },
        batchDeleteClick(){//批量删除

        },
        searchEvent(searchFrom){//搜索
            this.searchFrom = {...this.dataTableConfig.paramet,...searchFrom}
            
        },
        refreshClick(){
            this.dataTableConfig.paramet = this.searchFrom
            this.dataTableKey = Date.now()
        },
        selectedRowKeysChange(row){//获取选中表格rowKey
            this.selectedRowKeysArr = []
            row.forEach(item => {
                this.selectedRowKeysArr.push(item.id)
            });
        },
        toExamine(row){
            this.$refs.changeUnitRef.getData({title:'工作变更审核',isDisabled:true,...row})
            this.$refs.changeUnitRef.visible = true
        },
        viewClick(row){

        },
    }
}
</script>
<style lang="less">
    .info-manage-status-form{
        .ant-form-item-label{
            width: 70px;
        }
    }
</style>